import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入名字");
        String next = scanner.next();
        System.out.println("请输入年龄");
        int i = scanner.nextInt();
        System.out.println("请输入性别");
        String s = scanner.next();
        System.out.println("请输入人员描述");
        String next1 = scanner.next();
        System.out.println(next+","+i+","+s+","+next1);
        Person person = new Person(next, i, s, next1);
        try( FileOutputStream stream1 = new FileOutputStream("person.obj");
             ObjectOutputStream stream = new ObjectOutputStream(stream1);) {
            stream.writeObject(person);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
